package com.appkubes.fintech.admin.application.order.controller;

import com.appkubes.fintech.admin.application.order.service.RentRepayOrderService;
import com.appkubes.fintech.admin.application.order.entity.vo.RentRepayOrderVO;
import com.appkubes.fintech.admin.application.order.entity.dto.RentRepayOrderDTO;
import com.appkubes.fintech.common.response.Response;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 *
 * @author xqc
 * @date 	2020/01/04 23:48:56
 */
@RestController
@RequestMapping("rent/rentRepayOrder")
@Api(tags = "还款单", value = "RentRepayOrderController")
@Slf4j
public class RentRepayOrderController {

    @Autowired
    private RentRepayOrderService rentRepayOrderService;


    @ApiOperation(tags = "分页还款单", value = "queryPage")
    @PostMapping(value = "queryPage")
    public Response<PageInfo<RentRepayOrderDTO>> queryPage(@RequestBody RentRepayOrderVO rentRepayOrderVO) {
        PageInfo<RentRepayOrderDTO> pageInfo = rentRepayOrderService.queryPage(rentRepayOrderVO);
        return Response.success(pageInfo);
    }

    @ApiOperation(tags = "新增还款单", value = "save")
    @PostMapping(value = "save")
    public Response save(@RequestBody RentRepayOrderVO rentRepayOrderVO) {
        return rentRepayOrderService.save(rentRepayOrderVO);
    }

    @ApiOperation(tags = "更新还款单", value = "update")
    @PostMapping(value = "update")
    public Response update(@RequestBody RentRepayOrderVO rentRepayOrderVO) {

        return rentRepayOrderService.update(rentRepayOrderVO);
    }



    @ApiOperation(tags = "获取还款单", value = "getById")
    @PostMapping(value = "getById")
    public Response<RentRepayOrderDTO> getById(String id) {
        return rentRepayOrderService.getById(id);

    }

}
